#【练习】英雄游戏

class Hero:
    def __init__(self,name,hp,power):
        self.name=name
        self.hp=hp
        self.power=power
    def speak(self):
        print(f"欢迎来到英雄联盟,我的名字是{self.name},我的血量是{self.hp},我的攻击力{self.power}")

class Mage(Hero):
    def __init__(self,name,hp,power,magic):
        super().__init__(name, hp, power)
        self.magic=magic

    def speak(self):
        super().speak()
    def charm(self):
        if self.magic>50:
            print("释放技能")
            self.magic-=50
        else:
            print("魔力不够")


class Warrior(Hero):
    def __init__(self,name,hp,power,armor):
        super().__init__(name,hp,power)
        self.armor=armor

    def speak(self):
        super().speak()

    def armor_point(self,armor):
        self.armor=armor
        return f"护甲值为{self.armor}"


def fight(hero1: Hero, hero2: Hero):
    hero1.speak()
    hero2.speak()
    hero1_hp = hero1.hp
    hero2_hp = hero2.hp
    hero1_name = hero1.name
    hero2_name = hero2.name
    while True:
        hero1_hp = hero1_hp - 10
        hero2_hp = hero2_hp - 10
        if hero1_hp <= 0 or hero2_hp <= 0:
            if hero1_hp > hero2_hp:
                print(f"英雄{hero1_name}赢了")
                return hero1_name
            elif hero1_hp < hero2_hp:
                print("英雄赢了", hero2_name)
                return hero2_name
            else:
                return "平局"

if __name__ == '__main__':
    huangzi=Warrior("皇子",1500,100,300)
    huli=Mage("狐狸",1000,60,200)
    fight(huangzi,huli)